// src/access.ts
export default function access(initialState: { currentUser?: API.CurrentUser | undefined }) {
  const { currentUser } = initialState || {};
  return {
    canAdmin: currentUser && currentUser?.access === "ADMIN",
    canDoctor: currentUser && (currentUser?.access === "DOCTOR" || currentUser?.access === "ADMIN"),
    canGuest: currentUser && (currentUser?.access === "GUEST" || currentUser?.access === "ADMIN"),
    canDistributor: currentUser && (currentUser?.access === "DISTRIBUTOR" || currentUser?.access === "ADMIN"),
    canResourcer: currentUser && (currentUser?.access === "RESOURCER" || currentUser?.access === "ADMIN"),
    DoctorDistributor: currentUser && (currentUser?.access === "DOCTOR" || currentUser?.access === "DISTRIBUTOR" || currentUser?.access === "ADMIN"),
    DoctorDistributorResourcer: currentUser && (currentUser?.access === "RESOURCER" || currentUser?.access === "DOCTOR" || currentUser?.access === "DISTRIBUTOR" || currentUser?.access === "ADMIN"),
  };
}
